package {{.basepackage}}.entity;

import javax.persistence.Id;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import cn.pinming.pmsuite.utils.StringUtils;
import cn.pinming.pmsuite.service.BussinessEntityBase;
import cn.pinming.pmsuite.service.EntityBase;


/**
 * @version 1.0.0
 * @Project : {{.SiteName}}
 * @Package Name : {{.basepackage}}.controller
 * @Company 杭州品茗信息技术有限公司
 * @Author 林芳崽 on {{ .CreateTime }}.
 * @Description: {{.table.TableComment}}
 */
@Table(name = "{{.table.TableName}}")
public class {{.PascalName}}  implements Serializable,BussinessEntityBase,EntityBase<String>{
	
	//columns START
	{{range .columnList}}
	/**
     * {{.ColumnComment}}
     */
    {{if .IsPrimary}}
	@Id{{end}}
	private {{.SimpleJavaType}} {{.CamelName}};
	{{end}}
	//columns END 数据库字段结束

	//get and set
	{{range .columnList}}
	/**
     * {{.ColumnComment}}
     */{{if .IsPrimary}}
    @Override {{end}}
    public void set{{.PascalName}}({{.SimpleJavaType}} {{.CamelName}}) {{if eq .SimpleJavaType "String"}} {
         {{.CamelName}}=StringUtils.trim({{.CamelName}}) {{end}};
        this.{{.CamelName}} = {{.CamelName}};
    }

    {{if .IsPrimary}} @Override {{end}}
    @Column(name = "{{.ColumnName}}")
    public {{.SimpleJavaType}} get{{.PascalName}}() {
        return this.{{.CamelName}};
    }
    {{end}}

	@Override
	public String toString() {
		return new StringBuffer() {{range .columnList}}
			.append("{{.CamelName}}=").append(get{{.PascalName}}()).append(","){{end}}
			.toString();
	}
}